function getAddressMap(){
	if(addressSetMap!=null&&point!=null){
		setTimeout(function(){
			addressSetMap.setCenter(point);
			addMarker(point);
		}, 1000);
	}
}
	/*
	var map = new BMap.Map("addressSetMap");
	//getcity
	function myFun(result){
		var cityName = result.name;
		map.centerAndZoom(cityName, 14);
	}
	var myCity = new BMap.LocalCity();
	myCity.get(myFun);
	//overlay
	var oldMarker;
	lng="";
	lat="";
	map.addEventListener("click",function(e){
		map.removeOverlay(oldMarker);
		lng = e.point.lng;
		lat = e.point.lat;
		var marker = new BMap.Marker(new BMap.Point(e.point.lng,e.point.lat));  // 创建标注
		map.addOverlay(marker); 
		oldMarker=marker;
		var gc = new BMap.Geocoder();
		var pt = e.point;
		gc.getLocation(pt, function(rs){
		     var addComp = rs.addressComponents;
		     $("#dz_webk").html(addComp.street + addComp.streetNumber);
		     district = addComp.district;
	    	 city =  addComp.city;
	    	 province = addComp.province;
		 });  
	});
	//get navigation
	var top_left_navigation = new BMap.NavigationControl();  //左上角，添加默认缩放平移控件
	map.addControl(top_left_navigation);   
	*/
function addAddress(detail){
	$.ajax({
		url :interfaceMobileUrl+"/addAddress.json?userid="+userid+"&key="+userkey,
		jsonp: "callback",
	    dataType: "jsonp",
	    data:{
	    	longitude:point.lng,
	    	latitude:point.lat,
	    	province:province,
	    	city:city,
	    	district:district,
	    	detail:detail,
	    	defaultAddress:true
	    },
		error:function(){
			xfAlert("是不是网络不通啊");
		},
		success:function(data){
			if(data==1){
				xfAlert("您成功的增加了新地址");
				personalInfo();
			}else{
				console.log(data);
				xfAlert("增加新地址失败");
			}
		}
	});
}
$(function(){
//	refresh("shezhi");
	$("a[href='#huoyuedzStep1']").click(function(){
//		$("#huoyuedzStep1 header div a").attr("href","#shezhi");
		getAddressMap();
	});
	
	$("a[href='#huoyuedz']").click(function(){
		if(point == null){
			xfAlert("您还没有点击地图选择您的地址");
			return false;
		}
	});
	$("#confirmAddress").click(function(){
		var detail =$("#dz_webk").val();
		if(detail == ""){
			xfAlert("地址详情不能为空");
			return false;
		}
		addAddress(detail);
	});
});